using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Sys_Info - 网站信息 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ISysInfo<T> :ModelBase<SysInfo> where T : SysInfo, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.WebId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return WebId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.WebId=dy.WebId;
           this.Title=dy.Title;
           this.TxtId=dy.TxtId;
           this.IsBottom=dy.IsBottom;
        } 

        #region 定义属性

     
         /// <summary>
        /// webId
        /// </summary>
        private String _WebId = "";
      
        /// <summary>
        /// webId
        /// </summary>
        public String WebId
        {
            get 
            {
              return   (this._WebId); 
            }

            set 
            {
                    _WebId= value;  
            }
        }
       
     
         /// <summary>
        /// 标题
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 标题
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 内容
        /// </summary>
        private String _TxtId = "";
      
        /// <summary>
        /// 内容
        /// </summary>
        public String TxtId
        {
            get 
            {
              return   (this._TxtId); 
            }

            set 
            {
                    _TxtId= value;  
            }
        }
       
     
         /// <summary>
        /// 显示在底部
        /// </summary>
        private int _IsBottom =-1;
      
        /// <summary>
        /// 显示在底部
        /// </summary>
        public yq.Enums.SysInfo.IsBottom IsBottom
        {
            get 
            {
              return   (yq.Enums.SysInfo.IsBottom)this._IsBottom;  
            }

            set 
            {
                    _IsBottom= value.GetHashCode(); 
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(SysInfo info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["WebId"]!= DBNull.Value)
                  {
                  info.WebId=row["WebId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["TxtId"]!= DBNull.Value)
                  {
                  info.TxtId=row["TxtId"].ToString();
                 }
                 
                  
                  if(row["IsBottom"]!= DBNull.Value)
                  {
                  info.IsBottom=  (yq.Enums.SysInfo.IsBottom)(row["IsBottom"]) ;
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, SysInfo info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@WebId", DbType.String,ParameterTool.GetObj( info._WebId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@TxtId", DbType.String,ParameterTool.GetObj( info._TxtId )); 
            
             
                cn.AddInParameter(comm, "@IsBottom", DbType.Int32,ParameterTool.GetObj( info._IsBottom )); 
            
        } 

    } 
} 